package cn.hesion.dataStructures.Tree;

public class SegmentsTree<T> {
    SegTreeNode<T>[] nodes;
    T[]  srcArray;

    public SegmentsTree(Double n,T[] srcArray) {
        double finalLength = 2 * Math.pow(2,n);
        this.nodes = new SegTreeNode[(int) finalLength];
        this.srcArray = srcArray;
    }

    void segtree_build(int p,int l,int r){
        nodes[p].reset(p,l,r);
    }
}

class SegTreeNode<T>{
    T data;
    int pid;
    int len;

    int lson(){
        return pid << 1;
    }
    int rson(){
        return pid<<1|1;
    }


    public void reset(int p, int l, int r) {
        pid = p;
        len = r-l+1;
    }
}

